#pragma once
#include <MsHTML.h>
#include <atlbase.h>
#include <xmllite.h>

#include <string>
#include <map>
#include <memory>
#include <vector>

using std::wstring;
using std::map;
using std::vector;
using std::unique_ptr;

class CElement /*abstract*/
{
public:
	CElement(void);
	virtual ~CElement(void);

	virtual void InitElementFromXml(IXmlReader* pReader) throw(...);
	virtual void DoFill(IHTMLDocument2* document) throw(...) = 0;
	bool IsActiveX() const throw();

protected:
	wstring _tag;
	map<wstring, wstring> _mid;	// save the attributes that are used to find the element
	map<wstring, wstring> _maa;	// save the pre-defined attributes
	vector<unique_ptr<CElement>> _ve; // child elements

	virtual CComQIPtr<IHTMLElement> FindElement(IHTMLDocument2* document) const throw(...);
	virtual void BuildAvailableAttributes() throw() = 0;
	virtual void ValidateAttributes() const throw(...) = 0;
};

